function https_download(output_path, url)
  -- 导入所需的模块
  local http = require("socket.http")
  local https = require("ssl.https")
  local ltn12 = require("ltn12")

  dialog('https ->>'..tostring(https))
  dialog('ltn12 ->>'..tostring(ltn12))

  -- 设置超时时间（可选）
  https.TIMEOUT = 10  -- 10秒超时

  local sink = ltn12.sink.file(io.open(output_path, "wb"))
  local _, err = https.request{
      url = url,
      sink = sink,
      -- 如果需要验证 SSL 证书，你可以在这里设置证书
      -- verify = "path/to/certificate.pem",
  }
  if err then
      -- nLog("Error downloading file:", err)
      dialog("Error downloading file:"..tostring(err))
      return false
  end
  -- nLog("File downloaded successfully.")
  dialog("File downloaded successfully.")
  -- 使用了 ssl.https.request 函数来发送 HTTPS 请求，并使用 ltn12 库来处理数据的接收和写入文件。ltn12 是一个 Lua 库，用于处理 LuaSocket 的传输层。
  return true
end

function test()
  local filepath = userPath() .. '/aaaaa.zip'
  local url = 'https://gitee.com/BugCollect/lua-https-download/raw/master/README.md.zip'
  local bool = https_download(filepath, url)
  -- nLog('download bool='..tostring(bool))
  dialog('download bool='..tostring(bool))
end

test()